<script setup>
import { ref, onMounted } from 'vue'

// 动态图片切换
const currentBannerIndex = ref(0)
const banners = [
  { src: 'https://picsum.photos/id/100/1200/500', alt: '皮影戏表演' },
  { src: 'https://picsum.photos/id/101/1200/500', alt: '皮影戏人物' },
  { src: 'https://picsum.photos/id/102/1200/500', alt: '皮影戏舞台' }
]

// 自动切换轮播图
const startBannerRotation = () => {
  setInterval(() => {
    currentBannerIndex.value = (currentBannerIndex.value + 1) % banners.length
  }, 5000)
}

onMounted(() => {
  startBannerRotation()
})

// 皮影戏人物数据
const shadowFigures = [
  { id: 1, name: '穆桂英', description: '杨家将女将，英勇善战', image: 'https://picsum.photos/id/111/300/400' },
  { id: 2, name: '孙悟空', description: '《西游记》主角，神通广大', image: 'https://picsum.photos/id/112/300/400' },
  { id: 3, name: '白素贞', description: '《白蛇传》主角，美丽善良', image: 'https://picsum.photos/id/113/300/400' },
  { id: 4, name: '武松', description: '《水浒传》好汉，打虎英雄', image: 'https://picsum.photos/id/114/300/400' }
]

// 最新演出数据
const latestShows = [
  {
    id: 1,
    title: '大闹天宫',
    date: '2024-06-15',
    location: '北京展览馆',
    image: 'https://picsum.photos/id/150/400/300',
    description: '经典皮影戏《大闹天宫》，再现齐天大圣孙悟空的传奇故事。'
  },
  {
    id: 2,
    title: '白蛇传',
    date: '2024-06-20',
    location: '上海文化中心',
    image: 'https://picsum.photos/id/151/400/300',
    description: '经典爱情故事《白蛇传》，演绎白素贞与许仙的凄美爱情。'
  }
]
</script>

<template>
  <div class="home-container">
    <!-- 英雄区域 -->
    <section class="hero-section">
      <div class="hero-banner" :style="{ backgroundImage: `url(${banners[currentBannerIndex].src})` }">
        <div class="hero-overlay">
          <div class="hero-content">
            <h1 class="hero-title">影韵华彩</h1>
            <p class="hero-subtitle">千年光影，一脉相承</p>
            <blockquote class="hero-quote">
              "一口叙说千古事，双手对舞百万兵"
              <footer>—— 皮影戏艺诀</footer>
            </blockquote>
            <div class="hero-actions">
              <router-link to="/about" class="btn btn-primary">探索皮影艺术</router-link>
              <router-link to="/shows" class="btn btn-secondary">观看表演</router-link>
            </div>
          </div>
        </div>
        <!-- 皮影剪影装饰 -->
        <div class="shadow-decoration left"></div>
        <div class="shadow-decoration right"></div>
      </div>
    </section>

    <!-- 关于皮影戏 -->
    <section class="about-section">
      <div class="container">
        <h2 class="section-title">关于皮影戏</h2>
        <div class="about-content">
          <p>皮影戏，又称"<strong>影子戏</strong>"或"<strong>灯影戏</strong>"，是一种以兽皮或纸板做成的人物剪影以表演故事的民间戏剧。</p>
          <p>表演时，艺人们在白色幕布后面，一边操纵影人，一边用当地流行的曲调讲述故事，同时配以打击乐器和弦乐，有浓厚的乡土气息。</p>
          <p><strong>皮影戏</strong>是中国民间古老的传统艺术，老北京人都叫它"<strong>驴皮影</strong>"。据史书记载，皮影戏始于西汉，兴于唐朝，盛于清代，元代时期传至西亚和欧洲，可谓历史悠久，源远流长。</p>
        </div>
      </div>
    </section>

    <!-- 特色栏目快速入口 -->
    <section class="features-section">
      <div class="container">
        <h2 class="section-title">探索皮影艺术之美</h2>
        <div class="features-grid">
          <router-link to="/history" class="feature-card">
            <div class="feature-icon">📜</div>
            <h3 class="feature-title">历史源流</h3>
            <p class="feature-description">从西汉到现代的两千年传承</p>
          </router-link>
          <router-link to="/types" class="feature-card">
            <div class="feature-icon">🗺️</div>
            <h3 class="feature-title">地域流派</h3>
            <p class="feature-description">中国各地皮影艺术的独特魅力</p>
          </router-link>
          <router-link to="/plays" class="feature-card">
            <div class="feature-icon">🎭</div>
            <h3 class="feature-title">经典剧目</h3>
            <p class="feature-description">《白蛇传》《西游记》等传统名篇</p>
          </router-link>
          <router-link to="/artists" class="feature-card">
            <div class="feature-icon">👨‍🎨</div>
            <h3 class="feature-title">皮影大师</h3>
            <p class="feature-description">国家级非遗传承人的艺术人生</p>
          </router-link>
        </div>
      </div>
    </section>

    <!-- 经典皮影人物展示 -->
    <section class="figures-section container">
      <h2 class="section-title">经典皮影人物</h2>
      <div class="figures-grid">
        <div v-for="figure in shadowFigures" :key="figure.id" class="figure-card">
          <div class="figure-image-container">
            <img :src="figure.image" :alt="figure.name" class="figure-image" />
          </div>
          <h3 class="figure-name">{{ figure.name }}</h3>
          <p class="figure-description">{{ figure.description }}</p>
        </div>
      </div>
    </section>

    <!-- 最新演出信息 -->
    <section class="shows-section">
      <div class="container">
        <h2 class="section-title">最新演出信息</h2>
        <div class="shows-grid">
          <div v-for="show in latestShows" :key="show.id" class="show-card">
            <div class="show-image-container">
              <img :src="show.image" :alt="show.title" class="show-image" />
            </div>
            <div class="show-content">
              <h3 class="show-title">{{ show.title }}</h3>
              <div class="show-meta">
                <span class="show-date">📅 {{ show.date }}</span>
                <span class="show-location">🏢 {{ show.location }}</span>
              </div>
              <p class="show-description">{{ show.description }}</p>
              
              <router-link 
                :to="{ name: 'show-details', params: { id: show.id } }"
                class="btn btn-primary"
              >
                立即抢票
              </router-link>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
</template>

<style scoped>
/* 基础样式 - 典雅中国风色彩方案 */
:root {
  --color-primary: #8B1A1A; /* 深红褐色 - 主色 */
  --color-secondary: #F5F1E6; /* 宣纸米白 - 主色 */
  --color-accent: #D4AF37; /* 暗金色 - 辅助色 */
  --color-dark: #2A2A2A; /* 墨黑色 - 辅助色 */
  --color-tertiary-1: #5D4037; /* 深棕色 - 点缀色 */
  --color-tertiary-2: #8C6D46; /* 浅赭石 - 点缀色 */
  --color-text: #5D4037; /* 深棕色 - 正文 */
  --color-background: #F5F1E6; /* 宣纸米白 - 背景色 */
  --color-light: #FFFFFF;
  --color-text-light: #8C6D46; /* 浅赭石 - 次要文字 */
}

/* 宣纸纹理背景 */
.home-container {
  background-color: var(--color-background);
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23d4c7a6' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* 英雄区域 - 全屏设计 */
.hero-section {
  position: relative;
  height: 100vh;
  min-height: 700px;
  overflow: hidden;
}

.hero-banner {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: background-image 1.5s ease-in-out;
  position: relative;
  border-bottom: 4px solid var(--color-accent);
}

/* 皮影戏舞台效果 */
.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(166, 36, 36, 0.6), rgba(0, 0, 0, 0.7), rgba(166, 36, 36, 0.6));
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 2s ease-in-out;
  position: relative;
}

/* 皮影戏舞台边框 */
.hero-overlay::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  border: 3px solid var(--color-accent);
  opacity: 0.3;
  pointer-events: none;
}

/* 英雄区域内容 */
.hero-content {
  text-align: center;
  color: white;
  padding: 2rem;
  max-width: 800px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  backdrop-filter: blur(5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

/* 皮影戏内容装饰边框 */
.hero-content::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid var(--color-accent);
  opacity: 0.2;
  pointer-events: none;
}

.hero-title {
  font-size: 4.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
  font-family: 'STZhongsong', '华文行楷', serif;
  color: var(--color-accent);
  text-shadow: 4px 4px 8px rgba(42, 42, 42, 0.6);
  animation: slideDown 1s ease-out;
  letter-spacing: 5px;
  position: relative;
  display: inline-block;
  padding: 0 2rem;
}

/* 皮影戏标题装饰 */
.hero-title::before,
.hero-title::after {
  content: '☯';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  color: var(--color-accent);
  opacity: 0.8;
}

.hero-title::before {
  left: -30px;
}

.hero-title::after {
  right: -30px;
}

.hero-subtitle {
  font-size: 1.8rem;
  margin-bottom: 2rem;
  font-family: 'STKaiti', '楷体', serif;
  animation: slideDown 1.2s ease-out;
  opacity: 0.95;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
  font-style: italic;
  letter-spacing: 2px;
}

.hero-quote {
  font-size: 1.3rem;
  font-style: italic;
  margin-bottom: 2rem;
  padding: 1.5rem;
  border-left: 3px solid var(--color-accent);
  background-color: rgba(0, 0, 0, 0.3);
  animation: fadeIn 1.5s ease-out;
  font-family: 'STKaiti', '楷体', serif;
  letter-spacing: 1px;
}

.hero-quote footer {
  font-size: 1rem;
  margin-top: 0.5rem;
  color: var(--color-accent);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  animation: slideUp 1.5s ease-out;
}

/* 关于皮影戏部分 */
.about-section {
  padding: 4rem 0;
  background-color: var(--color-light);
}

.about-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
  border-left: 5px solid var(--color-primary);
}

.about-content p {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  line-height: 1.8;
  text-align: justify;
  color: var(--color-text);
}

.about-content strong {
  color: var(--color-primary);
  font-weight: bold;
}

/* 特色栏目快速入口 */
.features-section {
  padding: 4rem 0;
  background-color: var(--color-background);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.feature-card {
  background-color: var(--color-light);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  border-top: 4px solid var(--color-primary);
  background: linear-gradient(to bottom, var(--color-light), var(--color-secondary));
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background-color: var(--color-primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--color-primary);
}

.feature-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--color-secondary);
  font-family: 'STKaiti', '楷体', serif;
}

.feature-description {
  font-size: 1rem;
  color: var(--color-text);
  line-height: 1.6;
}

/* 经典皮影人物展示 */
.figures-section {
  padding: 4rem 0;
}

.figures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.figure-card {
  background-color: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.figure-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.figure-image-container {
  height: 300px;
  overflow: hidden;
}

.figure-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.figure-card:hover .figure-image {
  transform: scale(1.05);
}

.figure-name {
  font-size: 1.2rem;
  font-weight: bold;
  margin: 1rem;
  color: var(--color-secondary);
  font-family: 'STKaiti', '楷体', serif;
}

.figure-description {
  font-size: 1rem;
  color: var(--color-text);
  margin: 0 1rem 1.5rem;
  line-height: 1.6;
}

/* 最新演出信息 */
.shows-section {
  padding: 4rem 0;
  background-color: var(--color-light);
}

.shows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2.5rem;
  margin-top: 2rem;
}

.show-card {
  background-color: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.show-card:hover {
  transform: translateY(-12px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.show-image-container {
  height: 200px;
  overflow: hidden;
}

.show-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.show-card:hover .show-image {
  transform: scale(1.05);
}

.show-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.show-title {
  font-size: 1.4rem;
  font-weight: bold;
  margin-bottom: 1rem;
  color: var(--color-primary);
  font-family: 'STKaiti', '楷体', serif;
}

.show-meta {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  color: var(--color-text-light);
  font-size: 0.9rem;
}

.show-description {
  font-size: 1rem;
  color: var(--color-text);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex: 1;
}

/* 按钮样式 */
.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'STKaiti', '楷体', serif;
  letter-spacing: 1px;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  border: 2px solid var(--color-primary);
}

.btn-primary:hover {
  background-color: transparent;
  color: var(--color-primary);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
}

.btn-secondary:hover {
  background-color: var(--color-accent);
  color: var(--color-primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(212, 175, 55, 0.3);
}

/* 区块标题 */
.section-title {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
  font-family: 'STZhongsong', '华文行楷', serif;
  padding-bottom: 1rem;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(to right, transparent, var(--color-accent), transparent);
}

/* 容器样式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* 皮影戏装饰元素 */
.shadow-decoration {
  position: absolute;
  width: 200px;
  height: 400px;
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.15;
  animation: float 8s ease-in-out infinite;
  filter: drop-shadow(3px 3px 4px rgba(0, 0, 0, 0.3));
}

.shadow-decoration.left {
  left: -50px;
  top: 20%;
  background-image: url("../assets/shadow_figures.svg#leftFigure");
  animation-delay: 0s;
  transform-origin: center;
}

.shadow-decoration.right {
  right: -50px;
  top: 20%;
  background-image: url("../assets/shadow_figures.svg#rightFigure");
  animation-delay: 2s;
  transform-origin: center;
}

/* 皮影戏特色卡片样式 */
.feature-card {
  position: relative;
  background-color: var(--color-background-soft);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.3s ease;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(166, 36, 36, 0.2);
  border-color: var(--color-accent);
}

/* 卡片装饰边框 */
.feature-card::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  border: 1px solid var(--color-accent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.feature-card:hover::before {
  opacity: 0.6;
}

/* 皮影戏人物卡片样式增强 */
.figure-card {
  position: relative;
  background-color: var(--color-background-soft);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
  transition: all 0.4s ease;
  border: 1px solid var(--color-border);
}

.figure-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(166, 36, 36, 0.25);
  border-color: var(--color-accent);
}

.figure-card:hover .figure-image img {
  transform: scale(1.05);
}

.figure-card:hover .figure-info {
  background-color: var(--color-primary);
  color: white;
}

/* 演出卡片样式增强 */
.show-card {
  position: relative;
  background-color: var(--color-background-soft);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
  transition: all 0.4s ease;
  border: 1px solid var(--color-border);
}

.show-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(166, 36, 36, 0.2);
  border-color: var(--color-accent);
}

.show-card::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  border: 1px solid var(--color-accent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.show-card:hover::before {
  opacity: 0.4;
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(5deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .hero-title {
    font-size: 3rem;
  }
  
  .hero-subtitle {
    font-size: 1.2rem;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 200px;
    text-align: center;
  }
  
  .about-content {
    padding: 1.5rem;
  }
  
  .features-grid,
  .figures-grid,
  .shows-grid {
    grid-template-columns: 1fr;
  }
  
  .section-title {
    font-size: 1.8rem;
  }
  
  .shadow-decoration {
    width: 150px;
    height: 300px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .hero-quote {
    font-size: 1rem;
    padding: 1rem;
  }
  
  .container {
    padding: 0 1rem;
  }
  
  .show-card {
    margin-bottom: 2rem;
  }
}
</style>
